<?php
/**
 * 示例验证器
 * @version 1.0
 * @author: HuangYu <992287102@qq.com>
 * @since: 2019/4/2 15:26
 * Class DemoValidate
 * @package app\index\validate
 */

namespace app\index\validate;

use think\Validate;

class DemoValidate extends Validate
{
    //验证规则
    protected $rule = [
        'demo_id' => 'require',
        'title'   => 'require|max:25',
        'remark'  => 'max:100',
    ];

    //提示信息
    protected $message = [
        'title.require' => '标题不能为空',
        'title.max'     => '标题不能超过25个字符',
        'remark.max'    => '备注不能超过100个字符',
    ];

    //验证场景
    protected $scene = [
        'add'    => ['title', 'remark'],
        'update' => ['demo_id', 'title', 'remark'],
        'delete' => ['demo_id'],
    ];
}